package com.cc.crm.service.impl;

import com.cc.crm.mapper.UserInfoMapper;
import com.cc.crm.pojo.UserInfo;
import com.cc.crm.service.UserInfoService;
import com.cc.crm.vo.UserInfoVo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program:
 * @ClassName:
 * @description:
 * @author: zgc
 * @date:
 * @Version 1.0
 **/
@Service
public class UserInfoServiceImpl implements UserInfoService {
    @Resource
    private UserInfoMapper userInfoMapper;
    
    @Override
    public PageInfo<UserInfo> selectUserInfo(UserInfoVo userInfoVo) {
        //分页查询
        if (userInfoVo.getPageNum()!=null&&userInfoVo.getPageSize()!=null){
            Page<UserInfo> page = PageHelper.startPage(userInfoVo.getPageNum(), userInfoVo.getPageSize());
        }
        List<UserInfo> userInfoList = userInfoMapper.selectUserInfo(userInfoVo);
        //封装
        PageInfo<UserInfo> pageInfo = new PageInfo<>(userInfoList);
        return pageInfo;
    }

    @Override
    public int insertUserInfo(UserInfo userInfo) {
        return userInfoMapper.insertUserInfo(userInfo);
    }

    @Override
    public int updateUserInfo(UserInfo userInfo) {
        return userInfoMapper.updateUserInfo(userInfo);
    }

    @Override
    public int deleteUserInfo(UserInfo userInfo) {
        return userInfoMapper.deleteUserInfo(userInfo);
    }
}
